package com.rules.admin.expression;

import com.google.common.collect.Lists;

import java.io.Serializable;
import java.util.Iterator;
import java.util.List;

public class Deduction implements Expression, Serializable {
   private List<Expression> expressions = Lists.newArrayList();

   public List<Expression> getExpressions() {
      return this.expressions;
   }

   public void setExpressions(List<Expression> expressions) {
      this.expressions = expressions;
   }

   public void accept(ExpressionVisitor visitor) {
      visitor.vistor(this);
   }

   public String toString() {
      StringBuilder builder = new StringBuilder();
      Iterator var2 = this.expressions.iterator();

      while(var2.hasNext()) {
         Expression expression = (Expression)var2.next();
         if (expression != null) {
            builder.append("\n\t\t" + expression.toString().replaceAll("\\n", "\\\n\t\t") + ";\n");
         }
      }

      return builder.toString();
   }

   public void addDeduction(Expression expression) {
      this.expressions.add(expression);
   }
}
